package test.rpg {
	import flash.display.MovieClip;
	import flash.display.Sprite;
	import flash.events.Event;

	import gear.core.Game;
	import gear.game.DepthSort;
	import gear.net.AssetData;
	import gear.net.LibData;
	import gear.net.RESManager;
	import gear.net.SWFLoader;

	/**
	 * TestDepthSort
	 * 
	 * @author bright
	 * @version 20101009
	 */
	public class TestDepthSort extends Game {
		override protected function startup() : void {
			RESManager.instance.add(new SWFLoader(new LibData("assets/rpg.swf")));
			RESManager.instance.addEventListener(Event.COMPLETE, completeHandler);
			RESManager.instance.load();
		}

		private function completeHandler(event : Event) : void {
			var objLayer : Sprite = new Sprite();
			var ds : DepthSort = new DepthSort(objLayer);
			var role0 : MovieClip = RESManager.getMC(new AssetData("role", "rpg"));
			role0.x = 100;
			role0.y = 100;
			var role1 : MovieClip = RESManager.getMC(new AssetData("role", "rpg"));
			role1.x = 90;
			role1.y = 90;
			role1.scaleX = role1.scaleY = 0.9;
			var role2 : MovieClip = RESManager.getMC(new AssetData("role", "rpg"));
			role2.x = 80;
			role2.y = 80;
			role2.scaleX = role2.scaleY = 0.8;
			ds.add(role0);
			ds.add(role2);
			ds.add(role1);
			addChild(objLayer);
		}
	}
}
